package asteroids.model.programs.expression;

import java.util.ArrayList;

import asteroids.model.programs.expression.E;
import asteroids.model.programs.type.*;

public abstract class Logic extends BooleanExpression {

	protected E right;
	
	public Logic(int line, int column, E right) {
		super(line, column);
			this.right = right;
	}
	
	public E getRight(){
		return right;
	}
	
	public abstract Bool getValue();
	
	@Override
	public ArrayList<VariableExpression> getVariables(){
		return right.getVariables();
	}
	
	public String typecheck(){
		String rightTypeCheck = getRight().typecheck();
		if(!rightTypeCheck.equals(""))
			return rightTypeCheck;
		if(getRight().getClass() != BooleanExpression.class)
			return "Typecast error at line " + getLine() + ", column " + getColumn() + ".\n";
		return "";
	}
}
